# -*- coding: utf-8 -*-
__author__ = 'gerry'

menu = {
    'Beijing': {
        'ChaoYang': {
            'CBD': ['CICC', 'CCTV'],
            'JinRongJie': [""],
            'WangJing': ['Momo', 'ChuiZI']

        },
        'HaiDian': ['Baidu', 'YouKu']

    },
    'ShangHai': {
        "PuDong": ['Ctrip', '1 Shop'],
        "PuXi": ['China Bank', 'America Bank']
    }

}

print menu['Beijing']['ChaoYang']['WangJing'][0];

for k, v in menu.items():
    print k, v

exitFlag = False

print('**********************************************')
# enumerate枚举，在循环列表的时候把索引值显示出来

while not exitFlag:
    for index, key in enumerate(menu.keys()):
        print '->', index + 1, key
    choice_1 = raw_input("please choose menu to enter:").strip()  # strip()把回车和空格过滤掉
    if choice_1.isdigit() and choice_1 >= 1:  # isdigit():判断是否为整数
        choice_1 = int(choice_1)
        key_1 = menu.keys()[choice_1 - 1]
        while not exitFlag:
            for index, key in enumerate(menu[key_1].keys()):
                print '-->', index + 1, key
            choice_2 = raw_input("please choose menu to enter:").strip()
            if choice_2.isdigit() and choice_2 >= 1:  # isdigit():判断是否为整数
                choice_2 = int(choice_2)
                key_2 = menu[key_1].keys()[choice_2 - 1]
                while not exitFlag:
                    for index, key in enumerate(menu[key_1][key_2]):
                        print '--->', index + 1, key
                    choice_3 = raw_input("please choose menu to enter:").strip()

                    if choice_3.isdigit():
                        print 'this is the last level'
                    elif choice_3 == 'quit':
                        exitFlag = True
                    elif choice_3 == 'back':
                        break
                else:
                    print '=========going to quit==========='

            else:
                continue

        print '-----------------------------'

    else:
        continue



















